package com.cloudconsumerconsul.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@Slf4j
public class OrderConsulController {
	
	public static final String PAYMENT_URL = "http://cloud-provider-payment";
	
	@Autowired
	private RestTemplate restTemplate;

	@GetMapping("/consumer/payment/consul")
	public String getPayment() {
		log.info("调用生产者payment/consul成功！");
		return restTemplate.getForObject(PAYMENT_URL + "/payment/consul/", String.class);
	}
	
}